<?php
    session_start();

    if (!isset($_SESSION['user'])){
        header( 'Location: login.php');
    } 
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="../css/bootstrap.min.css" rel="stylesheet">
        <link rel="shortcut icon" href="/bootstrap/img/favicon.ico">
        
        <title>AC MILAN </title>
        
        <style type="text/css">
            .container {
            margin: 0 auto;
            max-width: 960px;
          }
          
        </style>
        </head>
            <?php require_once('../modulos/header.php'); ?> 
        
            <body  style="background-image: url(../img/rayas_verticales.jpg); background-size: 100%;">
               
                <?php require_once('../modulos/navbar.php');   ?>
                
                <div class='row'>
                    <br><br><br>
            <div class="col-md-8 text-center col-lg-offset-2" style="background: #e7e7e7; border-radius: 15px;">
                        <h1>Partido</h1>
                        <p class="lead">Completa las casillas con los datos de los diferentes partidos que disputará el Club, de acuerdo a lo establecido por la FIFA.</p>
                        <br>
                        <form method="POST" action="../insertar/calendario.php">
                            <div class="col-md-6">
                                <label>Fecha del partido:</label>
                                <input name="fecha" type="date" class="form-control" required>
                                <label>Hora del encuentro:</label>
                                <input name="hora" type="time" class="form-control" required>
                                <?php 
                                    require_once '../conex.php'; 
                                        $qr = "SELECT * FROM oponentes";
                                        $ejecutar = mysql_query($qr);

                                    ?>
                                    <label>Oponente:</label>
                                    <select class="form-control" name="oponente" required>
                                        <?php 
                                        while ($fila = mysql_fetch_array($ejecutar)){ ?>
                                        <option id="<?php echo $fila['idOponente']; ?>" value="<?php echo $fila['idOponente']; ?>">
                                            <?php echo $fila['Nombre']; 
                                            }   
                                        ?>
                                        </option>
                                    </select>
                                    <label>Lugar del encuentro:</label>
                                <input name="lugar" type="text" placeholder="Roma, Italia" class="form-control" required>                            
                                <?php  
                                        $qr4 = "SELECT * FROM formaciones";
                                        $ejecutar4 = mysql_query($qr4);

                                    ?>
                                    <label>Formación Local:</label>
                                    <select class="form-control" name="form_local" required>
                                        <?php 
                                        while ($fila4 = mysql_fetch_array($ejecutar4)){ ?>
                                        <option id="<?php echo $fila4['idFormaciones']; ?>" value="<?php echo $fila4['idFormaciones']; ?>">
                                            <?php echo $fila4['detalle']; 
                                            }   
                                        ?>
                                        </option>
                                    </select>
                            </div>
                            <div class="col-md-6">
                                  <?php 
                                        $qr2 = "SELECT * FROM temporadas";
                                        $ejecutar2 = mysql_query($qr2);

                                    ?>
                                    <label>Temporada:</label>
                                    <select class="form-control" name="temp" required>
                                        <?php 
                                        while ($fila1 = mysql_fetch_array($ejecutar2)){ ?>
                                        <option id="<?php echo $fila1['idTemporada']; ?>" value="<?php echo $fila1['idTemporada']; ?>">
                                            <?php echo $fila1['periodo']; 
                                            }   
                                        ?>
                                        </option>
                                    </select>
                                    <?php  
                                        $qr3 = "SELECT * FROM competiciones";
                                        $ejecutar3 = mysql_query($qr3);

                                    ?>
                                    <label>Competición:</label>
                                    <select class="form-control" name="comp" required>
                                        <?php 
                                        while ($fila2 = mysql_fetch_array($ejecutar3)){ ?>
                                        <option id="<?php echo $fila2['idCompeticiones']; ?>" value="<?php echo $fila2['idCompeticiones']; ?>">
                                            <?php echo $fila2['descripcion']; 
                                            }   
                                        ?>
                                        </option>
                                    </select>  
                                <label>Localía:</label>
                                <input name="localia" type="text" class="form-control" placeholder="local o visitante" required>  
                                    <?php  
                                        $qr6 = "SELECT * FROM formaciones";
                                        $ejecutar6 = mysql_query($qr6);
                                    ?>
                                    <label>Formación Rival:</label>
                                    <select class="form-control" name="form_rival" required>
                                        <?php 
                                        while ($fila6 = mysql_fetch_array($ejecutar6)){ ?>
                                        <option id="<?php echo $fila6['idFormaciones']; ?>" value="<?php echo $fila6['idFormaciones']; ?>">
                                            <?php echo $fila6['detalle']; 
                                            }   
                                        ?>
                                        </option>
                                    </select>
                                    <?php mysql_close(); ?>
                                    <br>
                                    <br>
                            </div>   
                                <div style="display: inline;">
                                    <button type="submit" class="btn btn-success"> Guardar</button>
                                    <button id="modificar" onclick="redirect();" class="btn btn-primary">Modificar</button>
                                </div>
                            </div>   
                        </form>
                    </div>        
            </div> 
       
        <script type='text/javascript' src="../js/jquery.min.js"></script>
        <script type='text/javascript' src="../js/bootstrap.js"></script>
        <script type='text/javascript' src="../js/bootstrap.min.js"></script>
        
        <script type="text/javascript">
            function redirect(){
                window.location = "mod_partido.php";
            }
        </script>
        
        <?php
        // put your code here
        ?>
        
    </body>
</html>